package com.kgdev.cweb.mbean.global.application;

import java.io.Serializable;
import java.text.DateFormat;
import java.util.Date;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;

import com.kgdev.cweb.mbean.global.session.LocalisationBean;

@ManagedBean
@RequestScoped
public class TimerBean implements Serializable {

	private static final long serialVersionUID = 1L;

	@ManagedProperty(value = "#{localisationBean}")
	LocalisationBean localisationBean;
	
	public void setLocalisationBean(LocalisationBean localisationBean) {
		this.localisationBean = localisationBean;
	}

	public String formatDate(Date date) {
		DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT,
				localisationBean.getCurrentLocale());
		return dateFormat.format(date);
	}

}
